package com.zsck.pos.activity.multiBill;

import com.zsck.pos.base.ApiSubscriber;
import com.zsck.pos.base.BaseModel;
import com.zsck.pos.base.CallbackListener;
import com.zsck.pos.bean.MultiBills;

import java.util.HashMap;
import java.util.Map;

public class MultiModel extends BaseModel implements MultiContract.Model {

    @Override
    public void loadMultiBills(String projectId, String condition, String collectionObjId, int currentPage,
                               int pageSize, String contractNo, String beginMonth, String endMonth, CallbackListener<MultiBills> callbackListener) {
        apiSubscriber =new ApiSubscriber<MultiBills>() {
            @Override
            public void onFailure(Throwable e, String errorMsg) {
                callbackListener.onCallbackFailed(errorMsg);
            }

            @Override
            public void onSuccess(MultiBills multiBills) {
                callbackListener.onCallbackSuccess(multiBills);
            }

        };
        Map requestData= new HashMap();
        requestData.put("projectId",projectId);
        requestData.put("condition",condition);
        requestData.put("collectionObjId",collectionObjId);
        requestData.put("currentPage",currentPage);
        requestData.put("pageSize",pageSize);
        requestData.put("contractNo",contractNo);
        requestData.put("beginMonth",beginMonth);
        requestData.put("endMonth",endMonth);
        addSubscription(apiService.getMultiPayList(requestData),apiSubscriber);
    }
}
